package com.sise.stuteaintersys.mapper;

import com.sise.stuteaintersys.bean.entity.Teacher;
import com.sise.stuteaintersys.bean.entity.TeacherExample;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface TeacherMapper {
    int countByExample(TeacherExample example);

    int deleteByExample(TeacherExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(Teacher record);

    int insertSelective(Teacher record);

    List<Teacher> selectByExample(TeacherExample example);

//    @Select("select * from teacher where id=#{id}")
//    Teacher selectPassword(Integer id);

    Teacher selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") Teacher record, @Param("example") TeacherExample example);

    int updateByExample(@Param("record") Teacher record, @Param("example") TeacherExample example);

    int updateByPrimaryKeySelective(Teacher record);

    int updateByPrimaryKey(Teacher record);

    /**
     * 查询所有teacher
     * @return
     */
    @Select("SELECT * FROM teacher")
    List<Teacher> findAll();

    /**
     * 根据姓名模糊查询
     * @param name
     * @return
     */
    @Select("SELECT * FROM teacher WHERE teacher.name LIKE concat(concat('%',#{name}),'%')")
    List<Teacher> findTeachers(String name);

    /**
     * 根据姓名进行查询
     * @param name
     * @return
     */
    @Select("SELECT * FROM teacher WHERE teacher.name =#{name}")
    List<Teacher> checkTeacher(String name);

}